﻿@model IEnumerable<ABCTile.Models.Contract>

@{
    ViewBag.Title = "Index";
    AjaxOptions ajaxOpts = new AjaxOptions
    {
        UpdateTargetId = "SearchResults",
        Url = Url.Action("SearchContract")
    };
}

<h2>Index</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>

@using (Ajax.BeginForm(ajaxOpts))
{
    <p>
        Find Contract : @Html.TextBox("SearchString") &nbsp;
        <input type="submit" value="Search" />
    </p>
}

<div id = "SearchResults">
<table>
    <tr>
        <th>
            CustomerID
        </th>
        <th>
            OwnerID
        </th>
        <th>
            Special section
        </th>
        <th>
            Agreement number
        </th>
        <th>
            Agreement Date
        </th>
        <th>
            Customer job number
        </th>
        <th>
            Prime contract number
        </th>
        <th>
            Contract amount
        </th>
        <th>
            Contract status
        </th>
        <th>
            Job start date
        </th>
        <th>
            Job end date
        </th>
        <th>
            DivisionID
        </th>
        <th>
            Comment
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.customerID)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.ownerID)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.spec_section)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.agreement_number)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.agreement_date)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.customer_job_number)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.prime_contract_number)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.contract_amount)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Status.StatusName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.job_start_date)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.job_end_date)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.division_id)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.comment)
        </td>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id=item.ProjectID }) |
            @Html.ActionLink("Details", "Details", new { id=item.ProjectID }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.ProjectID })
        </td>
    </tr>
}

</table>
</div>